/*
 *  msw7/windowImp.h
 *  mini
 *
 *  Created by jin on 1/1/11.
 *  Copyright 2011 cs. All rights reserved.
 *
 */

#ifndef INCLUDED_MSW7_WINDOW_IMP_H
#define INCLUDED_MSW7_WINDOW_IMP_H

#include <windows.h>
#include <windowImpBase.h>
#include <map>
#include <d2d1.h>

class Graphic2D;
class MSW7Graphic2D;

class MSW7WindowImp : public WindowImpBase
{
public:
    MSW7WindowImp(Window* owner_);
    virtual ~MSW7WindowImp();

    virtual void* GetHandle();
    virtual void Show(bool show);

    void OnResize(unsigned int width, unsigned int height);
    void OnPaint(Graphic2D& gc);

    HRESULT OnRender();
protected:
    static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
    static ATOM RegisterWindowClass();

    virtual bool HandleMouseLeftDown(WPARAM wParam, LPARAM lParam);
    virtual bool HandleMouseMove(WPARAM wParam, LPARAM lParam);
    virtual bool HandleMouseLeftUp(WPARAM wParam, LPARAM lParam);
    virtual bool HandlePaint(WPARAM wParam, LPARAM lParam);
    virtual bool HandleDestory(WPARAM wParam, LPARAM lParam);
    virtual bool HandleResize(WPARAM wParam, LPARAM lParam);

private:
    HWND hwd;
    MSW7Graphic2D *m_pGraphic;
};
#endif //INCLUDED_WINDOW_H
